/**
 * 
 */
package com.shanglida.maintabs;

import android.os.Bundle;

import com.shanglida.R;
import com.shanglida.popupwindow.NearByPopupWindow;
import com.shanglida.view.HeaderLayout;
import com.shanglida.view.HeaderLayout.HeaderStyle;
import com.shanglida.view.HeaderLayout.onMiddleImageButtonClickListener;
import com.shanglida.view.HeaderSpinner;
import com.shanglida.view.HeaderSpinner.onSpinnerClickListener;
import com.shanglida.view.SwitcherButton.SwitcherButtonState;
import com.shanglida.view.SwitcherButton.onSwitcherButtonClickListener;

/**
 * @author liu
 * @deprecated this activity use to find the customer&Store near by yours
 * @deprecated 1st activity &view and very important
 * @date 2014-03-07
 * @version 2.0
 */
public class NearByActivity extends TabItemActivity {
	private static HeaderLayout mHeaderLayout;
	private HeaderSpinner mHeaderSpinner;
	private NearByPopupWindow mPopupWindow;
	private NearByPeopleFragment mPeopleFragment;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_nearby);
		initViews();
		initEvents();
		init();
	}

	// set the title
	@Override
	protected void onResume() {
		NearByActivity.mHeaderLayout.setDefaultTitle("附近", null);
		super.onResume();
	}

	@Override
	protected void initViews() {
		mHeaderLayout = (HeaderLayout) findViewById(R.id.nearby_header);
		mHeaderLayout.init(HeaderStyle.DEFAULT_TITLE);
	}

	/*
	 * 
	 */
	@Override
	protected void initEvents() {

	}

	@Override
	protected void init() {

	}

	public class OnSpinnerClickListener implements onSpinnerClickListener {

		@Override
		public void onClick(boolean isSelect) {
			if (isSelect) {
				mPopupWindow
						.showViewTopCenter(findViewById(R.id.nearby_layout_root));
			} else {
				mPopupWindow.dismiss();
			}
		}
	}

	public class OnMiddleImageButtonClickListener implements
			onMiddleImageButtonClickListener {

		@Override
		public void onClick() {
			mHeaderLayout.showSearch();
		}
	}

	public class OnSwitcherButtonClickListener implements
			onSwitcherButtonClickListener {

		@Override
		public void onClick(SwitcherButtonState state) {
			// TODO Auto-generated method stub

		}

		// @Override
		// public void onClick(SwitcherButtonState state) {
		// FragmentTransaction ft = getSupportFragmentManager()
		// .beginTransaction();
		// ft.setCustomAnimations(R.anim.fragment_fadein,
		// R.anim.fragment_fadeout);
		// switch (state) {
		// case LEFT:
		// mHeaderLayout.init(HeaderStyle.TITLE_NEARBY_PEOPLE);
		// ft.replace(R.id.nearby_layout_content, mPeopleFragment)
		// .commit();
		// break;
		//
		// case RIGHT:
		// mHeaderLayout.init(HeaderStyle.TITLE_NEARBY_GROUP);
		// ft.replace(R.id.nearby_layout_content, mGroupFragment).commit();
		// break;
		// }
		// }

	}
}
